<!DOCTYPE html>
<html>
  <head>
    <script src="./node_modules/docx/build/index.umd.js"></script>
    <script src="./FileSaver.js"></script>
  </head>

  <body>
    <h1>自然保护地监测</h1>

    <button type="button" id="button1">
      自然保护地监测报告下载
    </button>

    <script>
      var arr
      var xhr = new XMLHttpRequest()
      xhr.responseType = "json"
      xhr.open("GET", "http://192.168.3.98:8091/exceltoword/selectZrbhdshape?jcsj=2024Q3")
      xhr.send()
      xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
          arr = xhr.response
          generate(arr)
          console.log(arr)
        }
      }
      function generate(arr) {
        var rows = [
            new docx.TableRow({
                children: [
                    new docx.TableCell({
                        children: [new docx.Paragraph({ text: "序 号" }),],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [new docx.Paragraph({ text: "图斑编号" }),],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "保护地和湿地名称" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "变化情况" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "图斑类型" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "图斑类型编码" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "功能区" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "县" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "乡镇" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "经度" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "纬度" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                    new docx.TableCell({
                        children: [
                        new docx.Paragraph({ text: "面积（平面米）" }),
                        ],
                        verticalAlign: docx.VerticalAlign.CENTER,
                    }),
                ],
            }),
        ]
       
        arr.forEach(item => {  
            rows.push(new docx.TableRow({  
                children: [  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.fid}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.number}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.address}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.bhqk}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.tblx}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.tbbm}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.gnq}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.xianming}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.zhenming}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.lon}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),  
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.lat}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),
                    new docx.TableCell({  
                        children: [new docx.Paragraph({ text: `${item.area}` })],  
                        verticalAlign: docx.VerticalAlign.CENTER,  
                    }),
                ],  
            }));  
        });
        
        var totalarea = 0;
        var increasecount = 0,increasearea = 0,decreasecount = 0,decreasearea = 0;
        var sjincreasecount = 0,sjincreasearea = 0,sjdecreasecount = 0,sjdecreasearea = 0;
        var xjincreasecount = 0,xjincreasearea = 0,xjdecreasecount = 0,xjdecreasearea = 0;
        var sdincreasecount = 0,sdincreasearea = 0,sddecreasecount = 0,sddecreasearea = 0;
        var rlhdincreasegroup = {} , bhqkincreasegroup = {} , bhdincreasegroup = {};
        var rlhddecreasegroup = {} , bhqkdecreasegroup = {} , bhddecreasegroup = {};
        var sjrlhdincreasegroup = {} , sjbhqkincreasegroup = {} , sjbhdincreasegroup = {};
        var xjrlhdincreasegroup = {} , xjbhqkincreasegroup = {} , xjbhdincreasegroup = {};
        var sdrlhdincreasegroup = {} , sdbhqkincreasegroup = {} , sdbhdincreasegroup = {};
        var sjrlhddecreasegroup = {} , sjbhqkdecreasegroup = {} , sjbhddecreasegroup = {};
        var xjrlhddecreasegroup = {} , xjbhqkdecreasegroup = {} , xjbhddecreasegroup = {};
        var sdrlhddecreasegroup = {} , sdbhqkdecreasegroup = {} , sdbhddecreasegroup = {};

        var sjbhdfl = {} , xjbhdfl = {} , sdbhdfl = {};
        arr.forEach(item => {
            const floatArea = parseFloat(item.area)*0.0015;
            const floatPercent = parseFloat(item.add_percentage)*100;
            const floatPercent2 = parseFloat(item.dec_percentage)*100;

            totalarea += floatArea;
            if(item.bhqk == "新增" || item.bhqk == "面积扩大" || item.bhqk == "强度增强"){
              increasecount++;
              increasearea += floatArea;
              if (!(item.tblx in rlhdincreasegroup)) {
                rlhdincreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in bhqkincreasegroup)) {
                bhqkincreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in bhdincreasegroup)) {
                bhdincreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              rlhdincreasegroup[item.tblx].count++;
              rlhdincreasegroup[item.tblx].area += floatArea;
              rlhdincreasegroup[item.tblx].percent += floatPercent;
              bhqkincreasegroup[item.bhqk].count++;
              bhqkincreasegroup[item.bhqk].area += floatArea;
              bhqkincreasegroup[item.bhqk].percent += floatPercent;
              bhdincreasegroup[item.bhdmc].count++;
              bhdincreasegroup[item.bhdmc].area += floatArea;
              bhdincreasegroup[item.bhdmc].percent += floatPercent;
            }

            if(item.bhqk == "强度减弱" || item.bhqk == "面积减少"){
              decreasecount++;
              decreasearea += floatArea;
              if (!(item.tblx in rlhddecreasegroup)) {
                rlhddecreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in bhqkdecreasegroup)) {
                bhqkdecreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in bhddecreasegroup)) {
                bhddecreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              rlhddecreasegroup[item.tblx].count++;
              rlhddecreasegroup[item.tblx].area += floatArea;
              rlhddecreasegroup[item.tblx].percent += floatPercent2;
              bhqkdecreasegroup[item.bhqk].count++;
              bhqkdecreasegroup[item.bhqk].area += floatArea;
              bhqkdecreasegroup[item.bhqk].percent += floatPercent2;
              bhddecreasegroup[item.bhdmc].count++;
              bhddecreasegroup[item.bhdmc].area += floatArea;
              bhddecreasegroup[item.bhdmc].percent += floatPercent2;
            }

            if( (item.bhqk == "新增" || item.bhqk == "面积扩大" || item.bhqk == "强度增强") && (item.bhdfl == "省级" || item.bhdfl == "省级重要") ){
              const floatPercent3 = parseFloat(item.add_sjys_percentage)*100;
              sjincreasecount++;
              sjincreasearea += floatArea;
              //省级
              if(!(item.bhdmc in sjbhdfl)){
                sjbhdfl[item.bhdmc] = {bhdmc: item.bhdmc};
              }
              if (!(item.tblx in sjrlhdincreasegroup)) {
                sjrlhdincreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in sjbhqkincreasegroup)) {
                sjbhqkincreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in sjbhdincreasegroup)) {
                sjbhdincreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              sjrlhdincreasegroup[item.tblx].count++;
              sjrlhdincreasegroup[item.tblx].area += floatArea;
              sjrlhdincreasegroup[item.tblx].percent += floatPercent3;
              sjbhqkincreasegroup[item.bhqk].count++;
              sjbhqkincreasegroup[item.bhqk].area += floatArea;
              sjbhqkincreasegroup[item.bhqk].percent += floatPercent3;
              sjbhdincreasegroup[item.bhdmc].count++;
              sjbhdincreasegroup[item.bhdmc].area += floatArea;
              sjbhdincreasegroup[item.bhdmc].percent += floatPercent3;
            }

            if( (item.bhqk == "新增" || item.bhqk == "面积扩大" || item.bhqk == "强度增强") && (item.bhdfl == "县级") ){
              xjincreasecount++;
              xjincreasearea += floatArea;
              const floatPercent3 = parseFloat(item.add_xj_percentage)*100;
              //省级
              if(!(item.bhdmc in xjbhdfl)){
                xjbhdfl[item.bhdmc] = {bhdmc: item.bhdmc};
              }
              if (!(item.tblx in xjrlhdincreasegroup)) {
                xjrlhdincreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in xjbhqkincreasegroup)) {
                xjbhqkincreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in xjbhdincreasegroup)) {
                xjbhdincreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              xjrlhdincreasegroup[item.tblx].count++;
              xjrlhdincreasegroup[item.tblx].area += floatArea;
              xjrlhdincreasegroup[item.tblx].percent += floatPercent3;
              xjbhqkincreasegroup[item.bhqk].count++;
              xjbhqkincreasegroup[item.bhqk].area += floatArea;
              xjbhqkincreasegroup[item.bhqk].percent += floatPercent3;
              xjbhdincreasegroup[item.bhdmc].count++;
              xjbhdincreasegroup[item.bhdmc].area += floatArea;
              xjbhdincreasegroup[item.bhdmc].percent += floatPercent3;
            }

            if( (item.bhqk == "新增" || item.bhqk == "面积扩大" || item.bhqk == "强度增强") && (item.bhdfl == "一般" ||item.bhdfl == "重要" || item.bhdfl == "省级重要") ){
              sdincreasecount++;
              sdincreasearea += floatArea;
              const floatPercent3 = parseFloat(item.add_sd_percentage)*100;
              if(!(item.bhdmc in sdbhdfl)){
                sdbhdfl[item.bhdmc] = {bhdmc: item.bhdmc};
              }
              if (!(item.tblx in sdrlhdincreasegroup)) {
                sdrlhdincreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in sdbhqkincreasegroup)) {
                sdbhqkincreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in sdbhdincreasegroup)) {
                sdbhdincreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              sdrlhdincreasegroup[item.tblx].count++;
              sdrlhdincreasegroup[item.tblx].area += floatArea;
              sdrlhdincreasegroup[item.tblx].percent += floatPercent3;
              sdbhqkincreasegroup[item.bhqk].count++;
              sdbhqkincreasegroup[item.bhqk].area += floatArea;
              sdbhqkincreasegroup[item.bhqk].percent += floatPercent3;
              sdbhdincreasegroup[item.bhdmc].count++;
              sdbhdincreasegroup[item.bhdmc].area += floatArea;
              sdbhdincreasegroup[item.bhdmc].percent += floatPercent3;
            }

            if((item.bhqk == "强度减弱" || item.bhqk == "面积减少") && (item.bhdfl == "省级" || item.bhdfl == "省级重要")){
              sjdecreasecount++;
              sjdecreasearea += floatArea;
              const floatPercent3 = parseFloat(item.dec_sjys_percentage)*100;
              //省级
              if (!(item.tblx in sjrlhddecreasegroup)) {
                sjrlhddecreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in sjbhqkdecreasegroup)) {
                sjbhqkdecreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in sjbhddecreasegroup)) {
                sjbhddecreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              sjrlhddecreasegroup[item.tblx].count++;
              sjrlhddecreasegroup[item.tblx].area += floatArea;
              sjrlhddecreasegroup[item.tblx].percent += floatPercent3;
              sjbhqkdecreasegroup[item.bhqk].count++;
              sjbhqkdecreasegroup[item.bhqk].area += floatArea;
              sjbhqkdecreasegroup[item.bhqk].percent += floatPercent3;
              sjbhddecreasegroup[item.bhdmc].count++;
              sjbhddecreasegroup[item.bhdmc].area += floatArea;
              sjbhddecreasegroup[item.bhdmc].percent += floatPercent3;

            }

            if((item.bhqk == "强度减弱" || item.bhqk == "面积减少") && (item.bhdfl == "县级")){
              xjdecreasecount++;
              xjdecreasearea += floatArea;
              const floatPercent3 = parseFloat(item.dec_xj_percentage)*100;
              //省级
              if (!(item.tblx in xjrlhddecreasegroup)) {
                xjrlhddecreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in xjbhqkdecreasegroup)) {
                xjbhqkdecreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in xjbhddecreasegroup)) {
                xjbhddecreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              xjrlhddecreasegroup[item.tblx].count++;
              xjrlhddecreasegroup[item.tblx].area += floatArea;
              xjrlhddecreasegroup[item.tblx].percent += floatPercent3;
              xjbhqkdecreasegroup[item.bhqk].count++;
              xjbhqkdecreasegroup[item.bhqk].area += floatArea;
              xjbhqkdecreasegroup[item.bhqk].percent += floatPercent3;
              xjbhddecreasegroup[item.bhdmc].count++;
              xjbhddecreasegroup[item.bhdmc].area += floatArea;
              xjbhddecreasegroup[item.bhdmc].percent += floatPercent3;

            }

            if((item.bhqk == "强度减弱" || item.bhqk == "面积减少") && (item.bhdfl == "一般" ||item.bhdfl == "重要" || item.bhdfl == "省级重要")){
              sddecreasecount++;
              sddecreasearea += floatArea;
              const floatPercent3 = parseFloat(item.dec_sd_percentage)*100;
              //省级
              if (!(item.tblx in sdrlhddecreasegroup)) {
                sdrlhddecreasegroup[item.tblx] = { area: 0,count: 0,percent: 0,tblx: item.tblx};
              }
              if (!(item.bhqk in sdbhqkdecreasegroup)) {
                sdbhqkdecreasegroup[item.bhqk] = { area: 0,count: 0,percent: 0,bhqk: item.bhqk};
              }
              if (!(item.bhdmc in sdbhddecreasegroup)) {
                sdbhddecreasegroup[item.bhdmc] = { area: 0,count: 0,percent: 0,bhdmc: item.bhdmc};
              }
              sdrlhddecreasegroup[item.tblx].count++;
              sdrlhddecreasegroup[item.tblx].area += floatArea;
              sdrlhddecreasegroup[item.tblx].percent += floatPercent3;
              sdbhqkdecreasegroup[item.bhqk].count++;
              sdbhqkdecreasegroup[item.bhqk].area += floatArea;
              sdbhqkdecreasegroup[item.bhqk].percent += floatPercent3;
              sdbhddecreasegroup[item.bhdmc].count++;
              sdbhddecreasegroup[item.bhdmc].area += floatArea;
              sdbhddecreasegroup[item.bhdmc].percent += floatPercent3;

            }


        });
        const rlhdgroupincreasekey = Object.keys(rlhdincreasegroup);
        const bhqkgroupincreasekey = Object.keys(bhqkincreasegroup);
        const bhdgroupincreasekey = Object.keys(bhdincreasegroup);
        const rlhdgroupdecreasekey = Object.keys(rlhddecreasegroup);
        const bhqkgroupdecreasekey = Object.keys(bhqkdecreasegroup);
        const bhdgroupdecreasekey = Object.keys(bhddecreasegroup);
        const sjrlhdgroupincreasekey = Object.keys(sjrlhdincreasegroup);
        const sjbhqkgroupincreasekey = Object.keys(sjbhqkincreasegroup);
        const sjbhdgroupincreasekey = Object.keys(sjbhdincreasegroup);
        const sjrlhdgroupdecreasekey = Object.keys(sjrlhddecreasegroup);
        const sjbhqkgroupdecreasekey = Object.keys(sjbhqkdecreasegroup);
        const sjbhdgroupdecreasekey = Object.keys(sjbhddecreasegroup);
        const xjrlhdgroupincreasekey = Object.keys(xjrlhdincreasegroup);
        const xjbhqkgroupincreasekey = Object.keys(xjbhqkincreasegroup);
        const xjbhdgroupincreasekey = Object.keys(xjbhdincreasegroup);
        const xjrlhdgroupdecreasekey = Object.keys(xjrlhddecreasegroup);
        const xjbhqkgroupdecreasekey = Object.keys(xjbhqkdecreasegroup);
        const xjbhdgroupdecreasekey = Object.keys(xjbhddecreasegroup);
        const sdrlhdgroupincreasekey = Object.keys(sdrlhdincreasegroup);
        const sdbhqkgroupincreasekey = Object.keys(sdbhqkincreasegroup);
        const sdbhdgroupincreasekey = Object.keys(sdbhdincreasegroup);
        const sdrlhdgroupdecreasekey = Object.keys(sdrlhddecreasegroup);
        const sdbhqkgroupdecreasekey = Object.keys(sdbhqkdecreasegroup);
        const sdbhdgroupdecreasekey = Object.keys(sdbhddecreasegroup);

        const sjbhdflkey = Object.keys(sjbhdfl);
        const xjbhdflkey = Object.keys(xjbhdfl);
        const sdbhdflkey = Object.keys(sdbhdfl);

        //原名为增加，2结尾 为减少
        var rlhdgrouparray = [] , bhqkgrouparray = [] , bhdgrouparray = [];
        var rlhdgrouparray2 = [] , bhqkgrouparray2 = [] , bhdgrouparray2 = [];
        var sjrlhdgrouparray = [] , sjbhqkgrouparray = [] , sjbhdgrouparray = [];
        var xjrlhdgrouparray = [] , xjbhqkgrouparray = [] , xjbhdgrouparray = [];
        var sdrlhdgrouparray = [] , sdbhqkgrouparray = [] , sdbhdgrouparray = [];
        var sjrlhdgrouparray2 = [] , sjbhqkgrouparray2 = [] , sjbhdgrouparray2 = [];
        var xjrlhdgrouparray2 = [] , xjbhqkgrouparray2 = [] , xjbhdgrouparray2 = [];
        var sdrlhdgrouparray2 = [] , sdbhqkgrouparray2 = [] , sdbhdgrouparray2 = [];

        var sjbhdflarray = [] , xjbhdflarray = [] , sdbhdflarray = [];
        
        for (let key of rlhdgroupincreasekey) {
          var temp = {};
          temp.tblx = rlhdincreasegroup[key].tblx;
          temp.area = rlhdincreasegroup[key].area;
          temp.count = rlhdincreasegroup[key].count;
          temp.percent = rlhdincreasegroup[key].percent;
          rlhdgrouparray.push(temp);
        }
        for (let key of bhqkgroupincreasekey) {
          var temp = {};
          temp.bhqk = bhqkincreasegroup[key].bhqk;
          temp.area = bhqkincreasegroup[key].area;
          temp.count = bhqkincreasegroup[key].count;
          temp.percent = bhqkincreasegroup[key].percent;
          bhqkgrouparray.push(temp);
        }
        for (let key of bhdgroupincreasekey) {
          var temp = {};
          temp.bhdmc = bhdincreasegroup[key].bhdmc;
          temp.area = bhdincreasegroup[key].area;
          temp.count = bhdincreasegroup[key].count;
          temp.percent = bhdincreasegroup[key].percent;
          bhdgrouparray.push(temp);
        }
        for (let key of rlhdgroupdecreasekey) {
          var temp = {};
          temp.tblx = rlhddecreasegroup[key].tblx;
          temp.area = rlhddecreasegroup[key].area;
          temp.count = rlhddecreasegroup[key].count;
          temp.percent = rlhddecreasegroup[key].percent;
          rlhdgrouparray2.push(temp);
        }
        for (let key of bhqkgroupdecreasekey) {
          var temp = {};
          temp.bhqk = bhqkdecreasegroup[key].bhqk;
          temp.area = bhqkdecreasegroup[key].area;
          temp.count = bhqkdecreasegroup[key].count;
          temp.percent = bhqkdecreasegroup[key].percent;
          bhqkgrouparray2.push(temp);
        }
        for (let key of bhdgroupdecreasekey) {
          var temp = {};
          temp.bhdmc = bhddecreasegroup[key].bhdmc;
          temp.area = bhddecreasegroup[key].area;
          temp.count = bhddecreasegroup[key].count;
          temp.percent = bhddecreasegroup[key].percent;
          bhdgrouparray2.push(temp);
        }
        for (let key of sjrlhdgroupincreasekey){
          var temp = {};
          temp.bhdmc = sjrlhdincreasegroup[key].tblx;
          temp.area = sjrlhdincreasegroup[key].area;
          temp.count = sjrlhdincreasegroup[key].count;
          temp.percent = sjrlhdincreasegroup[key].percent;
          sjrlhdgrouparray.push(temp);
        }
        for (let key of sjbhqkgroupincreasekey) {
          var temp = {};
          temp.bhqk = sjbhqkincreasegroup[key].bhqk;
          temp.area = sjbhqkincreasegroup[key].area;
          temp.count = sjbhqkincreasegroup[key].count;
          temp.percent = sjbhqkincreasegroup[key].percent;
          sjbhqkgrouparray.push(temp);
        }
        for (let key of sjbhdgroupincreasekey) {
          var temp = {};
          temp.bhdmc = sjbhdincreasegroup[key].bhdmc;
          temp.area = sjbhdincreasegroup[key].area;
          temp.count = sjbhdincreasegroup[key].count;
          temp.percent = sjbhdincreasegroup[key].percent;
          sjbhdgrouparray.push(temp);
        }
        for (let key of sjrlhdgroupdecreasekey){
          var temp = {};
          temp.tblx = sjrlhddecreasegroup[key].tblx;
          temp.area = sjrlhddecreasegroup[key].area;
          temp.count = sjrlhddecreasegroup[key].count;
          temp.percent = sjrlhddecreasegroup[key].percent;
          sjrlhdgrouparray2.push(temp);
        }
        for (let key of sjbhqkgroupdecreasekey) {
          var temp = {};
          temp.bhqk = sjbhqkdecreasegroup[key].bhqk;
          temp.area = sjbhqkdecreasegroup[key].area;
          temp.count = sjbhqkdecreasegroup[key].count;
          temp.percent = sjbhqkdecreasegroup[key].percent;
          sjbhqkgrouparray2.push(temp);
        }
        for (let key of sjbhdgroupdecreasekey) {
          var temp = {};
          temp.bhdmc = sjbhddecreasegroup[key].bhdmc;
          temp.area = sjbhddecreasegroup[key].area;
          temp.count = sjbhddecreasegroup[key].count;
          temp.percent = sjbhddecreasegroup[key].percent;
          sjbhdgrouparray2.push(temp);
        }
        for (let key of xjrlhdgroupincreasekey){
          var temp = {};
          temp.tblx = xjrlhdincreasegroup[key].tblx;
          temp.area = xjrlhdincreasegroup[key].area;
          temp.count = xjrlhdincreasegroup[key].count;
          temp.percent = xjrlhdincreasegroup[key].percent;
          xjrlhdgrouparray.push(temp);
        }
        for (let key of xjbhqkgroupincreasekey) {
          var temp = {};
          temp.bhqk = xjbhqkincreasegroup[key].bhqk;
          temp.area = xjbhqkincreasegroup[key].area;
          temp.count = xjbhqkincreasegroup[key].count;
          temp.percent = xjbhqkincreasegroup[key].percent;
          xjbhqkgrouparray.push(temp);
        }
        for (let key of xjbhdgroupincreasekey) {
          var temp = {};
          temp.bhdmc = xjbhdincreasegroup[key].bhdmc;
          temp.area = xjbhdincreasegroup[key].area;
          temp.count = xjbhdincreasegroup[key].count;
          temp.percent = xjbhdincreasegroup[key].percent;
          xjbhdgrouparray.push(temp);
        }
        for (let key of xjrlhdgroupdecreasekey){
          var temp = {};
          temp.tblx = xjrlhddecreasegroup[key].tblx;
          temp.area = xjrlhddecreasegroup[key].area;
          temp.count = xjrlhddecreasegroup[key].count;
          temp.percent = xjrlhddecreasegroup[key].percent;
          xjrlhdgrouparray2.push(temp);
        }
        for (let key of xjbhqkgroupdecreasekey) {
          var temp = {};
          temp.bhqk = xjbhqkdecreasegroup[key].bhqk;
          temp.area = xjbhqkdecreasegroup[key].area;
          temp.count = xjbhqkdecreasegroup[key].count;
          temp.percent = xjbhqkdecreasegroup[key].percent;
          xjbhqkgrouparray2.push(temp);
        }
        for (let key of xjbhdgroupdecreasekey) {
          var temp = {};
          temp.bhdmc = xjbhddecreasegroup[key].bhdmc;
          temp.area = xjbhddecreasegroup[key].area;
          temp.count = xjbhddecreasegroup[key].count;
          temp.percent = xjbhddecreasegroup[key].percent;
          xjbhdgrouparray2.push(temp);
        }
        for (let key of sdrlhdgroupincreasekey){
          var temp = {};
          temp.tblx = sdrlhdincreasegroup[key].tblx;
          temp.area = sdrlhdincreasegroup[key].area;
          temp.count = sdrlhdincreasegroup[key].count;
          temp.percent = sdrlhdincreasegroup[key].percent;
          sdrlhdgrouparray.push(temp);
        }
        for (let key of sdbhqkgroupincreasekey) {
          var temp = {};
          temp.bhqk = sdbhqkincreasegroup[key].bhqk;
          temp.area = sdbhqkincreasegroup[key].area;
          temp.count = sdbhqkincreasegroup[key].count;
          temp.percent = sdbhqkincreasegroup[key].percent;
          sdbhqkgrouparray.push(temp);
        }
        for (let key of sdbhdgroupincreasekey) {
          var temp = {};
          temp.bhdmc = sdbhdincreasegroup[key].bhdmc;
          temp.area = sdbhdincreasegroup[key].area;
          temp.count = sdbhdincreasegroup[key].count;
          temp.percent = sdbhdincreasegroup[key].percent;
          sdbhdgrouparray.push(temp);
        }
        for (let key of sdrlhdgroupdecreasekey){
          var temp = {};
          temp.tblx = sdrlhddecreasegroup[key].tblx;
          temp.area = sdrlhddecreasegroup[key].area;
          temp.count = sdrlhddecreasegroup[key].count;
          temp.percent = sdrlhddecreasegroup[key].percent;
          sdrlhdgrouparray2.push(temp);
        }
        for (let key of sdbhqkgroupdecreasekey) {
          var temp = {};
          temp.bhqk = sdbhqkdecreasegroup[key].bhqk;
          temp.area = sdbhqkdecreasegroup[key].area;
          temp.count = sdbhqkdecreasegroup[key].count;
          temp.percent = sdbhqkdecreasegroup[key].percent;
          sdbhqkgrouparray2.push(temp);
        }
        for (let key of sdbhdgroupdecreasekey) {
          var temp = {};
          temp.bhdmc = sdbhddecreasegroup[key].bhdmc;
          temp.area = sdbhddecreasegroup[key].area;
          temp.count = sdbhddecreasegroup[key].count;
          temp.percent = sdbhddecreasegroup[key].percent;
          sdbhdgrouparray2.push(temp);
        }
        for (let key of sjbhdflkey) {
          var temp = {};
          temp.bhdmc = sjbhdfl[key].bhdmc;
          sjbhdflarray.push(temp);
        }
        for (let key of xjbhdflkey) {
          var temp = {};
          temp.bhdmc = xjbhdfl[key].bhdmc;
          xjbhdflarray.push(temp);
        }
        for (let key of sdbhdflkey) {
          var temp = {};
          temp.bhdmc = sdbhdfl[key].bhdmc;
          sdbhdflarray.push(temp);
        }
        rlhdgrouparray.sort((a, b) => b.area - a.area);
        bhqkgrouparray.sort((a, b) => b.area - a.area);
        bhdgrouparray.sort((a, b) => b.area - a.area);
        rlhdgrouparray2.sort((a, b) => b.area - a.area);
        bhqkgrouparray2.sort((a, b) => b.area - a.area);
        bhdgrouparray2.sort((a, b) => b.area - a.area);
        sjrlhdgrouparray.sort((a, b) => b.area - a.area);
        sjbhqkgrouparray.sort((a, b) => b.area - a.area);
        sjbhdgrouparray.sort((a, b) => b.area - a.area);
        sjrlhdgrouparray2.sort((a, b) => b.area - a.area);
        sjbhqkgrouparray2.sort((a, b) => b.area - a.area);
        sjbhdgrouparray2.sort((a, b) => b.area - a.area);
        xjrlhdgrouparray.sort((a, b) => b.area - a.area);
        xjbhqkgrouparray.sort((a, b) => b.area - a.area);
        xjbhdgrouparray.sort((a, b) => b.area - a.area);
        xjrlhdgrouparray2.sort((a, b) => b.area - a.area);
        xjbhqkgrouparray2.sort((a, b) => b.area - a.area);
        xjbhdgrouparray2.sort((a, b) => b.area - a.area);
        sdrlhdgrouparray.sort((a, b) => b.area - a.area);
        sdbhqkgrouparray.sort((a, b) => b.area - a.area);
        sdbhdgrouparray.sort((a, b) => b.area - a.area);
        sdrlhdgrouparray2.sort((a, b) => b.area - a.area);
        sdbhqkgrouparray2.sort((a, b) => b.area - a.area);
        sdbhdgrouparray2.sort((a, b) => b.area - a.area);

        console.log(sjrlhdgrouparray,sjbhqkgrouparray,sjbhdgrouparray);

        var textpara1 = "根据2024年三季度安徽省芜湖市高分辨率遥感影像，经过解译分析，芜湖市市域范围内自然保护地、重要湿地和名录湿地共发现疑似人类活动变化监测图斑" 
                        + arr.length + "个，总面积约为" + parseFloat(totalarea).toFixed(2) + "亩。其中新增、扩大类型的人类活动变化监测图斑" + increasecount 
                        + "个，总面积约为" +  parseFloat(increasearea).toFixed(2) + "亩；减少类型的人类活动变化监测图斑" + decreasecount + "个，总面积约为"
                        + parseFloat(decreasearea).toFixed(2) + "亩。";
        var textpara2 = "其中新增、扩大类型的人类活动变化监测图斑" + increasecount  + "个，总面积约为" +  parseFloat(increasearea).toFixed(2) + "亩。";
        var textpara3 = "（1）按人类活动类型划分:"
        for(var i=0;i<rlhdgrouparray.length;i++){
          textpara3 += rlhdgrouparray[i].tblx + rlhdgrouparray[i].count + "个，面积为" +  parseFloat(rlhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara3 += rlhdgrouparray[0].tblx + "类图斑面积占比最高为" + parseFloat(rlhdgrouparray[0].percent).toFixed(2) + "%，其次是"
                    + rlhdgrouparray[1].tblx + "类占比" + parseFloat(rlhdgrouparray[1].percent).toFixed(2) + "%，"
                    + rlhdgrouparray[2].tblx + "类占比" + parseFloat(rlhdgrouparray[2].percent).toFixed(2) + "%。其余类型图斑面积占比较少，分别为"
        for(var i=3;i<rlhdgrouparray.length;i++){
          textpara3 += rlhdgrouparray[i].tblx + "占比" + parseFloat(rlhdgrouparray[i].percent).toFixed(2) + "%；"
        }
        
        var textpara4 = "（2）按变化情况分：";
        for(var i=0;i<bhqkgrouparray.length;i++){
          textpara4 += bhqkgrouparray[i].bhqk + "图斑" + bhqkgrouparray[i].count + "个，面积为" + parseFloat(bhqkgrouparray[i].area).toFixed(2) +  "亩；";
        }
        textpara4 += bhqkgrouparray[0].bhqk + "类图斑面积占比最大，为" + parseFloat(bhqkgrouparray[0].percent).toFixed(2) + "%，其次是"
                     + bhqkgrouparray[1].bhqk + "类图斑，面积占比为" + parseFloat(bhqkgrouparray[1].percent).toFixed(2) + "%,";
        for(var i=2;i<bhqkgrouparray.length;i++){
          textpara4 += bhqkgrouparray[i].bhqk + "类图斑占比" + parseFloat(bhqkgrouparray[i].percent).toFixed(2) + "%；";
        }
        textpara5 = "（3）按自然保护地和湿地划分："
        for(var i=0;i<bhdgrouparray.length;i++){
          textpara5 += bhdgrouparray[i].bhdmc + "图斑数量" + bhdgrouparray[i].count + "个，面积为" + parseFloat(bhdgrouparray[i].area).toFixed(2) + "亩；";
        }
        textpara5 += "位于" + bhdgrouparray[0].bhdmc + "的变化监测图斑面积占比最大，为" + parseFloat(bhdgrouparray[0].percent).toFixed(2) +"%；其次是" 
                    + bhdgrouparray[1].bhdmc + "，变化监测图斑面积占比为" + parseFloat(bhdgrouparray[1].percent).toFixed(2) + "%；"
                    + bhdgrouparray[2].bhdmc + "变化监测图斑面积占比为" + parseFloat(bhdgrouparray[2].percent).toFixed(2) + "%。其余自然保护地和湿地监测图斑面积占比较小，分别为：";
        for(var i=3;i<bhdgrouparray.length;i++){
          textpara5 += bhdgrouparray[i].bhdmc + "图斑面积占比" + parseFloat(bhdgrouparray[i].percent).toFixed(2) + "%；";
        }
        textpara6 = "减少类型的人类活动变化监测图斑" + decreasecount + "个，总面积约为" + parseFloat(decreasearea).toFixed(2) + "亩。（1）按人类活动类型划分："
        for(var i=0;i<rlhdgrouparray2.length;i++){
          textpara6 += rlhdgrouparray2[i].tblx + rlhdgrouparray2[i].count + "个，面积为" + parseFloat(rlhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(rlhdgrouparray2[i].percent).toFixed(2) + "%；"
        }
        textpara6 += "按变化情况划分："
        for(var i=0;i<bhqkgrouparray2.length;i++){
          textpara6 += bhqkgrouparray2[i].bhqk + bhqkgrouparray2[i].count + "个，面积为" + parseFloat(bhqkgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(bhqkgrouparray2[i].percent).toFixed(2) + "%；"
        }
        textpara6 += "（3）按自然保护地和湿地划分："
        for(var i=0;i<bhdgrouparray2.length;i++){
          textpara6 += bhdgrouparray2[i].bhdmc + bhdgrouparray2[i].count + "个，面积为" + parseFloat(bhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(bhdgrouparray2[i].percent).toFixed(2) + "%；"
        }
        var sjtotalcount = sjincreasecount + sjdecreasecount;
        var sjtotalarea = sjdecreasearea + sjincreasearea;
        textpara7 = "芜湖市市域范围内省级以上自然保护地发现人类活动变化监测图斑" + sjtotalcount + "个，面积为" + parseFloat(sjtotalarea).toFixed(2) + "分布在";
        for(var i=0;i<sjbhdflarray.length;i++){
          textpara7 += sjbhdflarray[i].bhdmc + "、"
        }
        textpara7 += "其中新增、扩大类型的人类活动变化监测图斑" + sjincreasecount + "个，总面积约为" + parseFloat(sjincreasearea).toFixed(2) + "亩；减少类型的人类活动变化监测图斑"
                    + sjdecreasecount + "个，总面积约为" +  parseFloat(sjdecreasearea).toFixed(2) + "亩。"

        textpara8 = "省级以上自然保护地新增、扩大类型的人类活动变化监测图斑" + sjincreasecount + "个，总面积约为" + parseFloat(sjincreasearea).toFixed(2) + "亩。"
        textpara9 = "（1）人类活动类型划分："
        for(var i=0;i<sjrlhdgrouparray.length;i++){
          textpara9 += sjrlhdgrouparray[i].bhdmc + sjrlhdgrouparray[i].count +"个，面积为" + parseFloat(sjrlhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara9 += sjrlhdgrouparray[0].bhdmc + "类图斑面积占比最大为" + parseFloat(sjrlhdgrouparray[0].percent).toFixed(2) + "%，其次为" + sjrlhdgrouparray[1].bhdmc + "类图斑面积占比"
                    + parseFloat(sjrlhdgrouparray[1].percent).toFixed(2) + "%，" + sjrlhdgrouparray[2].bhdmc + "类图斑面积占比" + parseFloat(sjrlhdgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<sjrlhdgrouparray.length;i++){
          textpara9 += sjrlhdgrouparray[i].bhdmc + "占比" + parseFloat(sjrlhdgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara10 = "（2）按变化情况划分："
        for(var i=0;i<sjbhqkgrouparray.length;i++){
          textpara10 += sjbhqkgrouparray[i].bhqk + sjbhqkgrouparray[i].count +"个，面积为" + parseFloat(sjbhqkgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara10 += sjbhqkgrouparray[0].bhqk + "类图斑面积占比最大为" + parseFloat(sjbhqkgrouparray[0].percent).toFixed(2) + "%，其次为" + sjbhqkgrouparray[1].bhqk + "类图斑面积占比"
                    + parseFloat(sjbhqkgrouparray[1].percent).toFixed(2) + "%，" + sjbhqkgrouparray[2].bhqk + "类图斑面积占比" + parseFloat(sjbhqkgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<sjbhqkgrouparray.length;i++){
          textpara10 += sjbhqkgrouparray[i].bhqk + "占比" + parseFloat(sjbhqkgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara11 = "（3）按自然保护地划分："
        for(var i=0;i<sjbhdgrouparray.length;i++){
          textpara11 += sjbhdgrouparray[i].bhdmc + sjbhdgrouparray[i].count +"个，面积为" + parseFloat(sjbhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara11 += sjbhdgrouparray[0].bhdmc + "类图斑面积占比最大为" + parseFloat(sjbhdgrouparray[0].percent).toFixed(2) + "%，其次为" + sjbhdgrouparray[1].bhdmc + "类图斑面积占比"
                    + parseFloat(sjbhdgrouparray[1].percent).toFixed(2) + "%，" + sjbhdgrouparray[2].bhdmc + "类图斑面积占比" + parseFloat(sjbhdgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<sjbhdgrouparray.length;i++){
          textpara11 += sjbhdgrouparray[i].bhdmc + "占比" + parseFloat(sjbhdgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara12 = "省级以上自然保护地减少类型的人类活动变化监测图斑" + sjdecreasecount + "个，总面积约为" + parseFloat(sjdecreasearea).toFixed(2) + "亩。（1）按人类活动类型划分："
        for(var i=0;i<sjrlhdgrouparray2.length;i++){
          textpara12 += sjrlhdgrouparray2[i].tblx + sjrlhdgrouparray2[i].count + "个，面积为" + parseFloat(sjrlhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(sjrlhdgrouparray2[i].percent).toFixed(2) + "%。"
        }
        textpara12 += "（2）按变化情况划分："
        for(var i=0;i<sjbhqkgrouparray2.length;i++){
          textpara12 += sjbhqkgrouparray2[i].bhqk + sjbhqkgrouparray2[i].count + "个，面积为" + parseFloat(sjbhqkgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(sjbhqkgrouparray2[i].percent).toFixed(2) + "%。"
        }
        textpara12 += "（3）按自然保护地划分："
        for(var i=0;i<sjbhdgrouparray2.length;i++){
          textpara12 += sjbhdgrouparray2[i].bhdmc + sjbhdgrouparray2[i].count + "个，面积为" + parseFloat(sjbhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(sjbhdgrouparray2[i].percent).toFixed(2) + "%。"
        }
        var xjtotalcount = xjincreasecount + xjdecreasecount;
        var xjtotalarea = xjdecreasearea + xjincreasearea;
        textpara13 = "芜湖市市域范围内县级自然保护地发现人类活动变化监测图斑" + xjtotalcount + "个，面积为" + parseFloat(xjtotalarea).toFixed(2) + "亩，分布在"
        for(var i=0;i<xjbhdflarray.length;i++){
          textpara13 += xjbhdflarray[i].bhdmc + "；"
        }
        textpara13 += "其中新增、扩大类型的人类活动变化监测图斑" + xjincreasecount + "个，总面积约为" + parseFloat(xjincreasearea).toFixed(2) + "亩；减少类型的人类活动变化监测图斑"
                      + xjdecreasecount + "个，总面积约为" + parseFloat(xjdecreasearea).toFixed(2) + "亩。"
        textpara14 = " 县级自然保护地新增、扩大类型的人类活动变化监测图斑" + xjincreasecount + "个，总面积约为" + parseFloat(xjincreasearea).toFixed(2) + "亩。"

        textpara15 = "（1）人类活动类型划分："
        for(var i=0;i<xjrlhdgrouparray.length;i++){
          textpara15 += xjrlhdgrouparray[i].tblx + xjrlhdgrouparray[i].count +"个，面积为" + parseFloat(xjrlhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara15 += xjrlhdgrouparray[0].tblx + "类图斑面积占比最大为" + parseFloat(xjrlhdgrouparray[0].percent).toFixed(2) + "%，其次为" + xjrlhdgrouparray[1].tblx + "类图斑面积占比"
                    + parseFloat(xjrlhdgrouparray[1].percent).toFixed(2) + "%，" + xjrlhdgrouparray[2].tblx + "类图斑面积占比" + parseFloat(xjrlhdgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<xjrlhdgrouparray.length;i++){
          textpara15 += xjrlhdgrouparray[i].tblx + "占比" + parseFloat(xjrlhdgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara16 = "（2）按变化情况划分："
        for(var i=0;i<xjbhqkgrouparray.length;i++){
          textpara16 += xjbhqkgrouparray[i].bhqk + xjbhqkgrouparray[i].count +"个，面积为" + parseFloat(xjbhqkgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara16 += xjbhqkgrouparray[0].bhqk + "类图斑面积占比最大为" + parseFloat(xjbhqkgrouparray[0].percent).toFixed(2) + "%，其次为" + xjbhqkgrouparray[1].bhqk + "类图斑面积占比"
                    + parseFloat(xjbhqkgrouparray[1].percent).toFixed(2) + "%，" + xjbhqkgrouparray[2].bhqk + "类图斑面积占比" + parseFloat(xjbhqkgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<xjbhqkgrouparray.length;i++){
          textpara16 += xjbhqkgrouparray[i].bhqk + "占比" + parseFloat(xjbhqkgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara17 = "（3）按自然保护地划分："
        for(var i=0;i<xjbhdgrouparray.length;i++){
          textpara17 += xjbhdgrouparray[i].bhdmc + xjbhdgrouparray[i].count +"个，面积为" + parseFloat(xjbhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara17 += xjbhdgrouparray[0].bhdmc + "类图斑面积占比最大为" + parseFloat(xjbhdgrouparray[0].percent).toFixed(2) + "%，其次为" + xjbhdgrouparray[1].bhdmc + "类图斑面积占比"
                    + parseFloat(xjbhdgrouparray[1].percent).toFixed(2) + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=2;i<xjbhdgrouparray.length;i++){
          textpara17 += xjbhdgrouparray[i].bhdmc + "占比" + parseFloat(xjbhdgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara18 = "县级自然保护地减少类型的人类活动变化监测图斑" + xjdecreasecount + "个，总面积约为" + parseFloat(xjdecreasearea).toFixed(2) + "亩。（1）按人类活动类型划分："
        for(var i=0;i<xjrlhdgrouparray2.length;i++){
          textpara18 += xjrlhdgrouparray2[i].tblx + xjrlhdgrouparray2[i].count + "个，面积为" + parseFloat(xjrlhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(xjrlhdgrouparray2[i].percent).toFixed(2) + "%。"
        }
        textpara18 += "（2）按变化情况划分："
        for(var i=0;i<xjbhqkgrouparray2.length;i++){
          textpara18 += xjbhqkgrouparray2[i].bhqk + xjbhqkgrouparray2[i].count + "个，面积为" + parseFloat(xjbhqkgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(xjbhqkgrouparray2[i].percent).toFixed(2) + "%。"
        }
        textpara18 += "（3）按自然保护地划分："
        for(var i=0;i<xjbhdgrouparray2.length;i++){
          textpara18 += xjbhdgrouparray2[i].bhdmc + xjbhdgrouparray2[i].count + "个，面积为" + parseFloat(xjbhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(xjbhdgrouparray2[i].percent).toFixed(2) + "%。"
        }
        var sdtotalcount = sdincreasecount + sddecreasecount;
        var sdtotalarea = sddecreasearea + sdincreasearea;
        textpara19 = "芜湖市市域范围内重要湿地和名录湿地发现人类活动变化监测图斑" + sdtotalcount + "个，面积为" + parseFloat(sdtotalarea).toFixed(2) + "亩，分布在"
        for(var i=0;i<sdbhdflarray.length;i++){
          textpara19 += sdbhdflarray[i].bhdmc + "；"
        }
        textpara19 += "其中新增、扩大类型的人类活动变化监测图斑" + sdincreasecount + "个，总面积约为" + parseFloat(sdincreasearea).toFixed(2) + "亩；减少类型的人类活动变化监测图斑"
                      + sddecreasecount + "个，总面积约为" + parseFloat(sddecreasearea).toFixed(2) + "亩。"
        textpara20 = " 芜湖市市域范围内重要湿地和名录湿地新增、扩大类型的人类活动变化监测图斑" + sdincreasecount + "个，总面积约为" + parseFloat(sdincreasearea).toFixed(2) + "亩。"
        textpara21 = "（1）人类活动类型划分："
        for(var i=0;i<sdrlhdgrouparray.length;i++){
          textpara21 += sdrlhdgrouparray[i].tblx + sdrlhdgrouparray[i].count +"个，面积为" + parseFloat(sdrlhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara21 += sdrlhdgrouparray[0].tblx + "类图斑面积占比最大为" + parseFloat(sdrlhdgrouparray[0].percent).toFixed(2) + "%，其次为" + sdrlhdgrouparray[1].tblx + "类图斑面积占比"
                    + parseFloat(sdrlhdgrouparray[1].percent).toFixed(2) + "%，" + sdrlhdgrouparray[2].tblx + "类图斑面积占比" + parseFloat(sdrlhdgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<sdrlhdgrouparray.length;i++){
          textpara21 += sdrlhdgrouparray[i].tblx + "占比" + parseFloat(sdrlhdgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara22 = "（2）按变化情况划分："
        for(var i=0;i<sdbhqkgrouparray.length;i++){
          textpara22 += sdbhqkgrouparray[i].bhqk + sdbhqkgrouparray[i].count +"个，面积为" + parseFloat(sdbhqkgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara22 += sdbhqkgrouparray[0].bhqk + "类图斑面积占比最大为" + parseFloat(sdbhqkgrouparray[0].percent).toFixed(2) + "%，其次为" + sdbhqkgrouparray[1].bhqk + "类图斑面积占比"
                    + parseFloat(sdbhqkgrouparray[1].percent).toFixed(2) + "%，" + sdbhqkgrouparray[2].bhqk + "类图斑面积占比" + parseFloat(sdbhqkgrouparray[2].percent).toFixed(2)
                    + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=3;i<sdbhqkgrouparray.length;i++){
          textpara22 += sdbhqkgrouparray[i].bhqk + "占比" + parseFloat(sdbhqkgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara23 = "（3）按自然保护地划分："
        for(var i=0;i<sdbhdgrouparray.length;i++){
          textpara23 += sdbhdgrouparray[i].bhdmc + sdbhdgrouparray[i].count +"个，面积为" + parseFloat(sdbhdgrouparray[i].area).toFixed(2) + "亩；"
        }
        textpara23 += sdbhdgrouparray[0].bhdmc + "类图斑面积占比最大为" + parseFloat(sdbhdgrouparray[0].percent).toFixed(2) + "%，其次为" + sdbhdgrouparray[1].bhdmc + "类图斑面积占比"
                    + parseFloat(sdbhdgrouparray[1].percent).toFixed(2) + "%。其余图斑类型面积占比较小，分别为：";
        for(var i=2;i<sdbhdgrouparray.length;i++){
          textpara23 += sdbhdgrouparray[i].bhdmc + "占比" + parseFloat(sdbhdgrouparray[i].percent).toFixed(2)+ "%；"
        }
        textpara24 = "芜湖市市域范围内重要湿地和名录湿地减少类型的人类活动变化监测图斑" + sddecreasecount + "个，总面积约为" + parseFloat(sddecreasearea).toFixed(2) + "亩。（1）按人类活动类型划分："
        for(var i=0;i<sdrlhdgrouparray2.length;i++){
          textpara24 += sdrlhdgrouparray2[i].tblx + sdrlhdgrouparray2[i].count + "个，面积为" + parseFloat(sdrlhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(sdrlhdgrouparray2[i].percent).toFixed(2) + "%。"
        }
        textpara24 += "（2）按变化情况划分："
        for(var i=0;i<sdbhqkgrouparray2.length;i++){
          textpara24 += sdbhqkgrouparray2[i].bhqk + sdbhqkgrouparray2[i].count + "个，面积为" + parseFloat(sdbhqkgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(sdbhqkgrouparray2[i].percent).toFixed(2) + "%。"
        }
        textpara24 += "（3）按自然保护地划分："
        for(var i=0;i<sdbhdgrouparray2.length;i++){
          textpara24 += sdbhdgrouparray2[i].bhdmc + sdbhdgrouparray2[i].count + "个，面积为" + parseFloat(sdbhdgrouparray2[i].area).toFixed(2) + "亩，占比" + parseFloat(sdbhdgrouparray2[i].percent).toFixed(2) + "%。"
        }
        console.log(textpara24);

        const doc = new docx.Document({
          sections: [
            {
              children: [
                new docx.Paragraph({
                  text: "3.1成果分析",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: "3.1.1自然保护地和湿地监测成果总体分析",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara1,
                }),
                new docx.Paragraph({
                  text: `一、对新增、扩大类型的人类活动变化监测图斑（以下简称“新增、扩大类监测图斑”）进行具体分析`,
                }),
                new docx.Paragraph({
                  text: textpara2,
                }),
                new docx.Paragraph({
                  text: textpara3,
                }),
                new docx.Paragraph({
                  text: textpara4,
                }),
                new docx.Paragraph({
                  text: textpara5,
                }),
                new docx.Paragraph({
                  text: `二、对减少类型的人类活动变化监测图斑（以下简称“减少类监测图斑”）进行具体分析：`,
                }),
                new docx.Paragraph({
                  text: textpara6,
                }),
                new docx.Paragraph({
                  text: "3.1.2省级以上自然保护地监测成果分析",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara7,
                }),
                new docx.Paragraph({
                  text: "一、对省级以上自然保护地新增、扩大类监测图斑进行具体分析：",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara8,
                }),
                new docx.Paragraph({
                  text: textpara9,
                }),
                new docx.Paragraph({
                  text: textpara10,
                }),
                new docx.Paragraph({
                  text: textpara11,
                }),
                new docx.Paragraph({
                  text: "二、对省级以上自然保护地减少类型的人类活动变化监测图斑进行具体分析：",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara12,
                }),
                new docx.Paragraph({
                  text: "3.1.3芜湖市域范围内县级自然保护地监测成果分析",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara13,
                }),
                new docx.Paragraph({
                  text: "一、对县级自然保护地新增、扩大类监测图斑进行具体分析：",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara14,
                }),
                new docx.Paragraph({
                  text: textpara15,
                }),
                new docx.Paragraph({
                  text: textpara16,
                }),
                new docx.Paragraph({
                  text: textpara17,
                }),
                new docx.Paragraph({
                  text: "二、对县级自然保护地减少类型的人类活动变化监测图斑进行具体分析：",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara18,
                }),
                new docx.Paragraph({
                  text: "3.1.4重要湿地和名录湿地监测成果分析",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara19,
                }),
                new docx.Paragraph({
                  text: "一、对重要湿地和名录湿地新增、扩大类监测图斑进行具体分析：",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara20,
                }),
                new docx.Paragraph({
                  text: textpara21,
                }),
                new docx.Paragraph({
                  text: textpara22,
                }),
                new docx.Paragraph({
                  text: textpara23,
                }),
                new docx.Paragraph({
                  text: "二、对重要湿地和名录湿地减少类监测图斑进行具体分析：",
                  heading: docx.HeadingLevel.HEADING_1,
                }),
                new docx.Paragraph({
                  text: textpara24,
                }),

                new docx.Paragraph({
                  text: "表3-1 芜湖市自然保护地遥感监测图斑统计表",
                  heading: docx.HeadingLevel.HEADING_3,
                  alignment: docx.AlignmentType.CENTER,
                }),

                new docx.Table({
                  rows: rows
                }),
              ],
            },
          ],
        });

        var button1 = document.getElementById("button1")
        button1.addEventListener("click", function () {
            docx.Packer.toBlob(doc).then((blob) => {
            console.log(blob);
            saveAs(blob, "自然保护地监测报告.docx");
            console.log("Document created successfully");
          });
        })
      }
    </script>
  </body>
</html>
